/*
 * $Id: $
 */
package org.rcgwt.client.ui.grid.model;

import org.rcgwt.client.ui.grid.event.IModelChangeState.ChangeStateType;
import org.rcgwt.client.ui.grid.internal.ModelChangeState;
import org.rcgwt.client.ui.grid.provider.IDataLoadedCallback;

import com.google.gwt.event.logical.shared.ValueChangeEvent;

/**
 * 
 * @author Olivier Oeuillot (latest modification by $Author: $)
 * @version $Revision: $ $Date: $
 */
public abstract class AbstractSimpleDataModel extends AbstractDataModel
        implements IDataLoadedCallback {

    @Override
    public void processDataInserted(int start, int count) {
        ValueChangeEvent.fire(this, new ModelChangeState(start, 0, count,
                ChangeStateType.STRUCTURE));
    }

    @Override
    public void processDataRemoved(int start, int count) {
        ValueChangeEvent.fire(this, new ModelChangeState(start, count, -count,
                ChangeStateType.STRUCTURE));
    }

    @Override
    public void processDataReplaced(int start, int count, int newCount) {
        ValueChangeEvent.fire(this, new ModelChangeState(start, count,
                newCount, ChangeStateType.STRUCTURE));
    }

    @Override
    public void processDataUpdated(int start, int count) {
        ValueChangeEvent.fire(this, new ModelChangeState(start, count, 0,
                ChangeStateType.UPDATE));
    }
}
